<?php
$pid=$_REQUEST["pid"];
function getConn(){
    $url="localhost:3306";
    $user="root";
    $password="";
    $database="php";
    $conn=mysqli_connect($url,$user,$password,$database);
    mysqli_query($conn,"set name utf8");
    return $conn;
}
$conn= getConn();
$sql="select p_image from product where p_id=$pid";
$result=mysqli_query($conn,$sql);
if($result){
    if($row=mysqli_fetch_assoc($result)){
        header("Content-Type:image/jpeg");
        echo $row["p_image"];
    }
}
?>